<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <script type="text/javascript" charset="utf-8" src="/js/jquery152-dev.js"></script>
  <script type="text/javascript" charset="utf-8" src="/js/menu.js"></script>
  <title>Kollekthor</title>
  <?php echo $this->headLink()->appendStylesheet('/css/global.css') ?>
  <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
          $("#filter").change(function() {
  <?php $url = '/' . Zend_Controller_Front::getInstance()->getRequest()->getControllerName() . '/changefilter'; ?>
              $.post('<?php echo $url ?>', { filter : $("#filter option:selected").val() }, function() {
                  location.reload();
              });
          });
      });
  </script>
</head>
<body>
<div id="background_header">
<div id="header">
	<div id="logo">
	<h1><a href="/home" ><img src="/images/logo.png" alt="logo" /></a></h1>
	</div>
	<div id="connexion">
		<p>Welcome
            <?php if ($this->user) {
                echo $this->user->login();
            ?>
        !
		<a href="<?php echo $this->url(array(), "logout", true); ?>">Log out</a>
        <?php } else { echo " !</p>"; } ?>
        </p>
	</div>
	<div id="searchbloc">
	    <form action="/user/filterNsearch" method="get" accept-charset="utf-8">
            <div>
            <!--<input id="search" />-->
			<label for="filter" id="label_filter">Filter</label>
			<select id="filter">
                <?php $opts = array(
                    "Alphabetical" => 'name ASC',
                    'Inverse alphabetical' => 'name DESC',
                    'Date (newer first)' => 'id DESC',
                    'Date (older first)' => 'id ASC'
                    );
                    foreach ($opts as $key => $val) {
                        echo '<option value="' . $val . '"';
                        if ($val == $this->filter) {
                            echo ' selected="selected"';
                        }
                        echo '>' . $key . '</option>';
                    } ?>
			</select>
            </div>
	    </form>
	</div>
	<div class="clear">&nbsp;</div>
	<div id="navigation">
    	<ul id="menu">
        	<li id="home" class="first_menu_item"><a href="<?php echo $this->url(array(), "home", true); ?>">Home</a></li>
        	<li><a href="/element/list">Files</a></li>
        	<li><a href="<?php echo $this->url(array(), "grouplist", true); ?>">Groups</a></li>
        	<li><a href="/element/add">Add</a></li>
    	</ul>
    </div>
    <div class="clear">&nbsp;</div>
</div>
<div id="content">
	<div id="page">
   	 	<?php echo $this->layout()->content ?>
	</div>
	<div id="social">
    <?php if ($this->user) { 
        echo $this->action("index", "social");
    ?>
    <?php } else { ?>
        <p id="no_log">You are not logged in!</p>
    <?php } ?>
	</div>
</div>
<div id="background_footer">
<div id="footer">
	footer
</div>
 </div>
 </div>
</body>
</html>